//
//  SYEmoticonButton.swift
//  YANAWeibo
//
//  Created by mac on 16/5/22.
//  Copyright © 2016年 itcast. All rights reserved.
//

import UIKit

class SYEmoticonButton: UIButton {
    /// 保存模型表情
    var emoticon: SYEmoticon? {
        didSet {
            guard let etn = emoticon else {
                return
            }
            hidden = false
            if etn.type == "0" {
                setImage(UIImage(named: etn.path!), forState: .Normal)
                setTitle(nil, forState: .Normal)
            } else {
                // emoji
                setTitle(etn.code?.changeStrToEmoji(), forState: .Normal)
                setImage(nil, forState: .Normal)
            }
            
        }
    }

}
